/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package processer;

import main.BotManager;
import utils.Debug;

/**
 *
 * @author Administrator
 */
public abstract class Processer {

    protected GameData gameData;
    protected RoBot parent;
    protected BotManager manager;
    private boolean isKillClient;
    private boolean isLostConnection;

    public Processer(RoBot parrent, GameData gameData, BotManager manager) {
        this.gameData = gameData;
        this.parent = parrent;
        this.manager = manager;
    }

    public void processMesage(String[] part) {
        if (part[0].equals("KILL")) {
            Debug.d("Có người đã đăng nhập nick của bạn");
            isKillClient = true;
            parent.stop();
            return;
        }
        if (part[0].equals("QUIT") && !isKillClient) {
            Debug.d("Mất kết nối mạng");
            isLostConnection = true;
            parent.stop();
            return;
        }
        if (part[0].equals("PING")) {
            parent.request.ping();
            return;
        }
        if (part[0].equals("MYMONEY")) {
            gameData.myMoney = Integer.parseInt(part[1]);
        }
    }

    public abstract void doLoop();
}
